<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>

<head>
    <link rel="stylesheet" type="text/css" href="/static/admin/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="/static/admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="/static/admin/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="/static/admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="/static/admin/css/style.css" />

    <link href="/static/admin/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
    <title>新增图片</title>
</head>

<body>
    <div class="page-container">
        <!-- <form class="form form-horizontal" id="form-picture-add">
            <div class="row cl">
                <div class="formControls col-xs-8 col-sm-4">
                    <div class="uploader-thum-container">
                        <input type="file" name="img" id="img">
                        <button id="btn-star" class="btn btn-default btn-uploadstar radius ml-10">开始上传</button>
                    </div>
                </div>
            </div>
        </form> -->
        <form class="form form-horizontal" id="form-article-add" method="POST" enctype="multipart/form-data">
            <input type="hidden" name="cid" value="{$map.cid}">
            <input type="hidden" name="sid" value="{$map.sid}">
            <div class="row cl">
                <label class="form-label col-xs-2 col-sm-1">图片：</label>
                <div class="formControls col-xs-6 col-sm-2">
                        <input type="file" name="img" id="img">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-2 col-sm-1">排序值：</label>
                <div class="formControls col-xs-4 col-sm-1">
                    <input type="number" class="input-text" id="sort" name="sort">
                </div>
            </div>
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                    <button class="btn btn-primary radius" type="submit">
                        <i class="Hui-iconfont">&#xe632;</i>提交</button>
                    <button onClick="window.history.back();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
                </div>
            </div>
        </form>
    </div>
    </div>

    <!--_footer 作为公共模版分离出去-->
    <script type="text/javascript" src="/static/admin/lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="/static/admin/lib/layer/2.4/layer.js"></script>

    <script type="text/javascript" src="/static/admin/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
    <script type="text/javascript" src="/static/admin/lib/jquery.validation/1.14.0/validate-methods.js"></script>
    <script type="text/javascript" src="/static/admin/lib/jquery.validation/1.14.0/messages_zh.js"></script>
    <script type="text/javascript" src="/static/admin/js/H-ui.js"></script>
    <script type="text/javascript" src="/static/admin/js/H-ui.admin.page.js"></script>

    <!--/_footer /作为公共模版分离出去-->

    <!--请在下方写此页面业务相关的脚本-->
    <script type="text/javascript">
        //添加图片
        function addthumb() {
            layer.open({
                type: 2,
                area: ['600px', '400px'],
                fix: false, //不固定
                maxmin: true,
                shade: 0.4,
                title: '添加图片',
                content: '{:url("file_manager/addThumb")}'
            });
        }

        // ajax 上传文件
        function uploadBanner() {
            if ($("#upload_file").val() == '') {
                layer.msg("请选择要上传的文件", {
                    icon: 6,
                    time: 1000
                });
                return false;
            } else {
                var formData = new FormData($("#form-banner")[0]);
                //ajax上传
                $.ajax({
                    url: 'upload',
                    type: 'POST',
                    async: true,
                    cache: false,
                    data: formData,
                    processData: false,
                    contentType: false,
                    dataType: "json",
                    beforeSend: function () {
                        uploading = true;
                    },
                    success: function (data) {
                        if (data.status == 1) {
                            $("#showimg").attr("src", '/' + data.imgname);

                            $("#banner").val('/' + data.bar);
                        } else {
                            layer.msg(data.msg);

                            return false;
                        }
                        uploading = false;
                    }
                });
            }
        }
    </script>
</body>

</html>